home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xa / EntityTable.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.0 KB  |  111 lines

  1. package com.extensibility.xa;
  2.  
  3. import com.extensibility.app.BaseAction;
  4. import com.extensibility.rock.RTable;
  5. import com.extensibility.rock.table.QlickerDataSource;
  6. import com.extensibility.xml.EntityDeclaration;
  7. import javax.swing.JComponent;
  8. import javax.swing.JTable;
  9. import javax.swing.KeyStroke;
  10. import javax.swing.table.TableCellEditor;
  11. import javax.swing.table.TableCellRenderer;
  12.  
  13. public final class EntityTable extends DeclTable {
  14.    static EntityHeader rendHdr = new EntityHeader();
  15.    EntityModel model;
  16.    public BaseAction toggleIncludeAction = new 1(this, "toggle.include");
  17.    KeyStroke keyInclude;
  18.  
  19.    public EntityTable(EntityModel var1) {
  20.       super(var1);
  21.       this.model = var1;
  22.    }
  23.  
  24.    public TableCellRenderer createHeaderRenderer(int var1) {
  25.       return (TableCellRenderer)(var1 <= 2 ? super.createHeaderRenderer(var1) : rendHdr);
  26.    }
  27.  
  28.    public TableCellEditor createCellEditor(int var1) {
  29.       if (this.model.isInternal()) {
  30.          switch (var1) {
  31.             case 2:
  32.                return new NameQlicker((QlickerDataSource)null);
  33.             case 3:
  34.                return new ValueQlicker((QlickerDataSource)null);
  35.          }
  36.       } else {
  37.          switch (var1) {
  38.             case 2:
  39.                return new NameQlicker((QlickerDataSource)null);
  40.             case 3:
  41.                return new SystemQlicker((QlickerDataSource)null);
  42.             case 4:
  43.                return new PublicQlicker((QlickerDataSource)null);
  44.             case 5:
  45.                return this.model.isGE() ? new TargetQlicker(this.model) : null;
  46.          }
  47.       }
  48.  
  49.       return null;
  50.    }
  51.  
  52.    public int getInitialWidth(int var1) {
  53.       return var1 == 2 ? 100 : 0;
  54.    }
  55.  
  56.    public double getColumnWeight(int var1) {
  57.       if (this.model.isInternal()) {
  58.          switch (var1) {
  59.             case 2:
  60.                return 0.2;
  61.             case 3:
  62.                return 0.8;
  63.          }
  64.       } else {
  65.          switch (var1) {
  66.             case 2:
  67.                return 0.2;
  68.             case 3:
  69.                return 0.4;
  70.             case 4:
  71.                return this.model.isGE() ? (double)0.25F : 0.4;
  72.             case 5:
  73.                return this.model.isGE() ? 0.15 : (double)0.0F;
  74.          }
  75.       }
  76.  
  77.       return (double)0.0F;
  78.    }
  79.  
  80.    public EntityDeclaration getSelectedEntity() {
  81.       int var1 = ((RTable)this).getSelectedRow();
  82.       return var1 < 0 ? null : ((EntityModel)((JTable)this).getModel()).getEntity(var1);
  83.    }
  84.  
  85.    public void addNotify() {
  86.       super.addNotify();
  87.       EntityModel var1 = (EntityModel)((JTable)this).getModel();
  88.       this.keyInclude = KeyStroke.getKeyStroke(var1.getHeaderMnemonic(5), 8);
  89.       if (!var1.isGE()) {
  90.          ((JComponent)this).registerKeyboardAction(this.toggleIncludeAction, this.keyInclude, 1);
  91.       }
  92.    }
  93.  
  94.    public void removeNotify() {
  95.       super.removeNotify();
  96.       ((JComponent)this).unregisterKeyboardAction(this.keyInclude);
  97.    }
  98.  
  99.    public boolean hasCellDialog(int var1, int var2) {
  100.       if (this.model.isInternal()) {
  101.          if (var2 == 3) {
  102.             return true;
  103.          }
  104.       } else if (var2 == 3 || var2 == 4) {
  105.          return true;
  106.       }
  107.  
  108.       return false;
  109.    }
  110. }
  111.